﻿@using CleanArchitecture.Blazor.Application.Features.Contacts.Queries.Pagination
@inject IStringLocalizer<Contacts> L

<MudExpansionPanel @bind-Expanded="_advancedSearchExpanded"
                   Class="pa-2 mb-3" Text="@ConstantString.AdvancedSearch">
    <MudGrid>
        <MudItem xs="12" sm="6" md="4">
            <!-- Add advanced search query fields here -->
            @*<MudTextField @bind-Value="ContactsQuery.Name" 
                          Placeholder="@L["Search for name"]"
                          Clearable="true"
                          TextChanged="TextChanged">
            </MudTextField>*@
        </MudItem>
     </MudGrid>
</MudExpansionPanel>

@code {
    [EditorRequired][Parameter] public ContactsWithPaginationQuery ContactsQuery { get; set; } = null!;
    [EditorRequired][Parameter] public EventCallback<string> OnConditionChanged { get; set; }
    private bool _advancedSearchExpanded;
    private async Task TextChanged(string str)
    {
        if (_advancedSearchExpanded)
        {
          await OnConditionChanged.InvokeAsync(str);
        }
    }
}